﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SongJian.aspx.cs" Inherits="syc.Sale.SongJian" %>

<head id="Head1" runat="server">
    <title></title>
</head>
<body onload="load()">

    <script type="text/javascript" language="javascript" src="/common.js"></script>

    <link rel="stylesheet" href="/ZhiJian/jquery.checkbox.css" />
    <link rel="stylesheet" href="/ZhiJian/jquery.safari-checkbox.css" />

    <script type="text/javascript" language="javascript" src="/common.js"></script>

    <script type="text/javascript" src="jquery.js"></script>

    <script type="text/javascript" src="jquery.checkbox.min.js"></script>

    <script src="clearbox.js" type="text/javascript"></script>

    <form id="form1" runat="server">
    <div id="wintop" class="wintop">
        <asp:Label ID="YuanLiaoTitle" runat="server" Text="原料送检管理"></asp:Label></div>
  
            <asp:Panel ID="Panel1" runat="server" CssClass="panel">
                <asp:Button ID="SongJianChuLi" runat="server" CssClass="button" OnClick="SongJianChuLi_Click"
                    Text="保存送检" OnClientClick="if(!confirm('确认保存已选送检记录吗?')) return false;" />
            </asp:Panel>
            <asp:Panel ID="Panel2" runat="server" CssClass="panel" GroupingText="查 询">
                供货单位：<asp:DropDownList ID="GongHuo" runat="server" DataSourceID="SqlDataSource2"
                    DataTextField="名称" DataValueField="ID" Width="140px">
                </asp:DropDownList>
                &nbsp;&nbsp;&nbsp;&nbsp;订购产品：<asp:DropDownList ID="ChanPin" runat="server" DataSourceID="SqlDataSource3"
                    DataTextField="品名" DataValueField="ID" Width="220" Font-Size="12px">
                </asp:DropDownList>
                &nbsp;<br />
                炉&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 号：<asp:TextBox ID="LuHao" runat="server" CssClass="intxt1"
                    Width="140px"></asp:TextBox>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:Label ID="Status"
                        runat="server" Text="送检状态："></asp:Label><asp:DropDownList ID="DPStatus" runat="server"
                            Width="140px">
                        </asp:DropDownList>
                <br />
                开始日期：<asp:TextBox ID="Date1" runat="server" CssClass="intxt1" Width="140px"></asp:TextBox><img
                    align="middle" alt="" onclick="makecalendar(document.getElementById('Date1').value, document.getElementById('Date1'));"
                    src="/Icons/29.png" />
                结束日期：<asp:TextBox ID="Date2" runat="server" CssClass="intxt1" Width="140px"></asp:TextBox><img
                    align="middle" alt="" onclick="makecalendar(document.getElementById('Date2').value, document.getElementById('Date2'));"
                    src="/Icons/29.png" />&nbsp; (根据送检日期设定筛选范围)<br />
                &nbsp;<asp:Button ID="Button3" runat="server" Text="筛 选" CssClass="mbutton" UseSubmitBehavior="False"
                    OnClick="Button_Query_Click" />
                <span>                  
                    <asp:Button ID="Button_Clear" runat="server" CssClass="mbutton" OnClick="Button_Clear_Click"
                        Text="清空条件" UseSubmitBehavior="false" />
                </span>
                 <asp:Button ID="ToExcel" runat="server" Text="导 出" CssClass="mbutton" 
                    UseSubmitBehavior="False" onclick="ToExcel_Click"/>
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>"
                    SelectCommand="SELECT 0 as [ID], '全部' as [名称] UNION SELECT [ID], [名称] FROM [原料供货单位]">
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>"
                    SelectCommand="SELECT 0 as [ID], '全部' as [品名] UNION SELECT [ID], [品名]+'('+钢级+')'+规格 FROM [原料]">
                </asp:SqlDataSource>
            </asp:Panel>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:Panel ID="Panel3" runat="server" CssClass="panel2">
                <asp:Label ID="Message" runat="server" Text="·准备就绪" CssClass="prompt"></asp:Label>
            </asp:Panel>
            <div class="gridframe">
                <div class="gridview">
                    <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#e5cfab">
                        <tr>
                            <td class="grid-title">
                                原料送检
                            </td>
                        </tr>
                        <tr>
                            <td class="grid-back">
                                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                                    ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
                                    onselected="SqlDataSource1_Selected">
                                </asp:SqlDataSource>
                                <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                                    CssClass="grid" DataKeyNames="ID" DataSourceID="SqlDataSource1" GridLines="None"
                                    OnDataBound="GridView1_DataBound" OnPageIndexChanged="GridView1_PageIndexChanged"
                                    AllowSorting="True" UseAccessibleHeader="False">
                                    <PagerSettings Visible="False" />
                                    <RowStyle CssClass="grid-row-normal" />
                                    <SelectedRowStyle CssClass="grid-row-bright" />
                                    <Columns>
                                        <asp:TemplateField HeaderText="">
                                            <ItemTemplate>
                                                <asp:Button ID="Button1" runat="server" CommandName="Select" Text="选择" CssClass="hide" />
                                                <img src="/Icons/online.gif" style="margin-top: 2px;" alt="" />
                                            </ItemTemplate>
                                            <HeaderStyle CssClass="grid-header" />
                                            <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="20px" />
                                        </asp:TemplateField>
                                        <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" Visible="false"
                                            ItemStyle-CssClass="grid" HeaderStyle-CssClass="grid-header" SortExpression="ID"
                                            ItemStyle-Width="80" ItemStyle-HorizontalAlign="Center" ReadOnly="True">
                                            <HeaderStyle CssClass="grid-header"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Center" CssClass="grid" Width="80px"></ItemStyle>
                                        </asp:BoundField>
                                        <asp:BoundField DataField="名称" HeaderText="名称" SortExpression="名称" ItemStyle-CssClass="grid"
                                            HeaderStyle-CssClass="grid-header" ItemStyle-Width="90">
                                            <HeaderStyle CssClass="grid-header"></HeaderStyle>
                                            <ItemStyle CssClass="grid" Width="90px" HorizontalAlign="Center"></ItemStyle>
                                        </asp:BoundField>
                                        <asp:BoundField DataField="品名" HeaderText="品名" SortExpression="品名" ItemStyle-CssClass="grid"
                                            HeaderStyle-CssClass="grid-header" ItemStyle-Width="120">
                                            <HeaderStyle CssClass="grid-header"></HeaderStyle>
                                            <ItemStyle CssClass="grid" Width="120px" HorizontalAlign="Center"></ItemStyle>
                                        </asp:BoundField>
                                        <asp:BoundField DataField="炉号" HeaderText="炉号" ItemStyle-CssClass="grid" HeaderStyle-CssClass="grid-header"
                                            ItemStyle-HorizontalAlign="right" ItemStyle-Width="90">
                                            <HeaderStyle CssClass="grid-header"></HeaderStyle>
                                            <ItemStyle CssClass="grid" Width="90px" HorizontalAlign="Center"></ItemStyle>
                                        </asp:BoundField>
                                        <asp:BoundField DataField="规格" HeaderText="规格" SortExpression="规格" ItemStyle-CssClass="grid"
                                            HeaderStyle-CssClass="grid-header" ItemStyle-Width="80">
                                            <HeaderStyle CssClass="grid-header"></HeaderStyle>
                                            <ItemStyle CssClass="grid" Width="80px" HorizontalAlign="Center"></ItemStyle>
                                        </asp:BoundField>
                                          <asp:BoundField DataField="钢级" HeaderText="钢级"  ItemStyle-CssClass="grid"
                                            HeaderStyle-CssClass="grid-header" ItemStyle-Width="80">
                                            <HeaderStyle CssClass="grid-header"></HeaderStyle>
                                            <ItemStyle CssClass="grid" Width="80px" HorizontalAlign="Center"></ItemStyle>
                                        </asp:BoundField>
                                        <asp:BoundField DataField="到货日期" HeaderText="到货日期" SortExpression="到货日期" Visible="true"
                                            ItemStyle-CssClass="grid" HeaderStyle-CssClass="grid-header" ItemStyle-HorizontalAlign="center"
                                            ItemStyle-Width="100" DataFormatString="{0:d}">
                                            <HeaderStyle CssClass="grid-header"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Center" CssClass="grid" Width="100px"></ItemStyle>
                                        </asp:BoundField>
                                        <asp:TemplateField HeaderText="是否送检" ItemStyle-CssClass="grid" HeaderStyle-CssClass="grid-header"
                                            ItemStyle-HorizontalAlign="center" ItemStyle-Width="60">
                                            <ItemTemplate>
                                                <asp:CheckBox ID="CheckBox" runat="server" Checked='<%# Bind("送检状态") %>' ToolTip='<%# Eval("ID") %>'>
                                                </asp:CheckBox>
                                            </ItemTemplate>
                                            <ControlStyle CssClass="torf" />
                                            <HeaderStyle CssClass="grid-header"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Center" CssClass="grid" Width="60px"></ItemStyle>
                                        </asp:TemplateField>
                                        <asp:BoundField DataField="送检日期" HeaderText="送检日期" SortExpression="送检日期" ItemStyle-CssClass="grid"
                                            HeaderStyle-CssClass="grid-header" ItemStyle-HorizontalAlign="center" ItemStyle-Width="80"
                                            DataFormatString="{0:d}">
                                            <HeaderStyle CssClass="grid-header"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Center" CssClass="grid" Width="80px"></ItemStyle>
                                        </asp:BoundField>                                       
                                        <asp:TemplateField HeaderText="是否合格" ItemStyle-CssClass="grid" HeaderStyle-CssClass="grid-header"
                                            ItemStyle-HorizontalAlign="center" ItemStyle-Width="60">
                                            <ItemTemplate>
                                                <%if (Request.QueryString["depart"] == "gongying")
                                                  {%>
                                                <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("合格状态") %>' AutoPostBack="false" 
                                                    ReadOnly="true"></asp:CheckBox>
                                                <%}
                                                  else if (Request.QueryString["depart"] == "zhijian")
                                                  { %>
                                                <asp:CheckBox ID="CheckBox2" runat="server" Checked='<%# Bind("合格状态") %>' ToolTip='<%# Eval("ID") %>'
                                                    OnCheckedChanged="CheckBox1_CheckedChanged" AutoPostBack="True"></asp:CheckBox>
                                                <%} %>
                                            </ItemTemplate>
                                            <HeaderStyle CssClass="grid-header"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Center" CssClass="grid" Width="60px"></ItemStyle>
                                        </asp:TemplateField>                                       
                                <asp:TemplateField HeaderText="判定状态" ItemStyle-BackColor="#ff6600" ItemStyle-ForeColor="#ffffff">
                                <ItemTemplate>
                                    <asp:Label ID="Label_zt" runat="server" Text='<%# Eval("状态描述") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="60px" />
                            </asp:TemplateField>
                             <asp:BoundField DataField="判定日期" HeaderText="判定日期" SortExpression="判定日期" ItemStyle-CssClass="grid"
                                            HeaderStyle-CssClass="grid-header" ItemStyle-HorizontalAlign="center" ItemStyle-Width="80"
                                            DataFormatString="{0:d}">
                                            <HeaderStyle CssClass="grid-header"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Center" CssClass="grid" Width="80px"></ItemStyle>
                                        </asp:BoundField>
                                    </Columns>
                                </asp:GridView>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                 <table width="100%">
	                    <tr>
	                        <td class="pagebar">
                                <asp:Button ID="Button_Pager_First" UseSubmitBehavior="false" runat="server" Text="" ToolTip="首页" 
                                    CssClass="pageturn-first-b" onclick="Pager_Click" CommandName="--" />
                                <asp:Button ID="Button_Pager_Prev" UseSubmitBehavior="false" runat="server" Text="" ToolTip="上一页" 
                                    CssClass="pageturn-prev-b" onclick="Pager_Click" CommandName="-" />
                                <input type="button" class="page-split" UseSubmitBehavior="false" disabled />第<asp:TextBox 
                                    ID="TextBox_Pager" AutoPostBack="True" runat="server" CssClass="pageturn" 
                                    ontextchanged="Pager_Click"></asp:TextBox>页<input type="button" class="page-split" disabled /><asp:Label ID="Label_Pages" UseSubmitBehavior="false" runat="server"></asp:Label><input type="button" class="page-split" disabled />
                                
                                <asp:Button ID="Button_Pager_Next" UseSubmitBehavior="false" runat="server" Text="" ToolTip="下一页" 
                                    CssClass="pageturn-next-b" onclick="Pager_Click" CommandName="+" />
                                <asp:Button ID="Button_Pager_Last" UseSubmitBehavior="false" runat="server" Text="" ToolTip="末页" 
                                    CssClass="pageturn-last-b" onclick="Pager_Click" CommandName="++" /><asp:Label ID="Label9" runat="server"></asp:Label><input type="button" class="page-split" disabled />
                            </td>
                            <td class="pagebar" align="right">
                                <asp:Label ID="Label_Total" runat="server"></asp:Label>
                            </td>
                        </tr>
                   </table>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    </form>

    <script>
        function load() {
            //alert("Hello from Load");
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
            EndRequestHandler();
        }

        function EndRequestHandler() {
            var url = window.location.href;
            var depart = url.split("?")[1].split("=")[1];
            if (depart == "zhijian") {

                $('input:checkbox:not([safari])').checkbox();
                $('input[safari]:checkbox').checkbox({ cls: 'jquery-safari-checkbox' });
                $('input:radio').checkbox();
            } else {

            }
            var textboxs = document.getElementsByTagName("input");
            var i;
            for (i = 0; i < textboxs.length; i++) {
                if (textboxs[i].className == "textbox") {
                    textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
                    textboxs[i].onfocus = function(e) { this.select(); };
                }
                else if (textboxs[i].className == "pageturn" || textboxs[i].className == "intxt1" || textboxs[i].className == "intxt2") {
                    textboxs[i].onfocus = function(e) { this.select(); };
                }

            }
            var rows = document.getElementsByTagName("tr");
            for (i = 0; i < rows.length; i++) {

                if (rows[i].className == "grid-row-normal") {
                    rows[i].onmouseover = function() { this.className = "grid-row-bright"; };
                    rows[i].onmouseout = function() { this.className = "grid-row-normal"; };
                    rows[i].onclick = selectRow;
                }
            }
            var tds = document.getElementsByTagName("td");
            for (i = 0; i < tds.length; i++) {
                if (tds[i].className == "detailheader") {
                    tds[i].innerHTML = tds[i].innerHTML.replace("*", "<span class=required>*</span>");
                }
            }
        }
   

    </script>

</body>
</html>